package com.qingxin.park.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 地块种植信息表
 */
@Entity
@Table(name = "park_block_plant")
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class ParkBlockPlant extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = -5949327457427856445L;
	// Fields

	private String plantid;
	private ParkBlock parkBlock;
	private String cropid;
	private String cropName;
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date beginTime;
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date endTime;
	private String isCurrent;//当前种植：0=历史、1=当前
	private String plantStatus;//状态：0=未成熟、1=已成熟
	private String plantType;//类型：1种植、2养殖、3加工
	private String isdel;//0正常1删除
	private String remark;
	private String createBy;
	private Date createTime;
	private String updateBy;
	private Date updateTime;
	private Set<ProRecord> proRecords = new HashSet<ProRecord>(0);
	private Set<BatchProducts> batchProductses = new HashSet<BatchProducts>(0);

	// Constructors

	/** default constructor */
	public ParkBlockPlant() {
	}
	

	public ParkBlockPlant(String plantid) {
		this.plantid = plantid;
	}


	/** full constructor */
	public ParkBlockPlant(ParkBlock parkBlock, String cropid, String cropName,
			Date beginTime, Date endTime, String isCurrent,
			String plantStatus, String plantType, String isdel, String remark, String createBy,
			Date createTime, String updateBy, Date updateTime,
			Set<ProRecord> proRecords, Set<BatchProducts> batchProductses) {
		this.parkBlock = parkBlock;
		this.cropid = cropid;
		this.cropName = cropName;
		this.beginTime = beginTime;
		this.endTime = endTime;
		this.isCurrent = isCurrent;
		this.plantStatus = plantStatus;
		this.plantType = plantType;
		this.isdel = isdel;
		this.remark = remark;
		this.createBy = createBy;
		this.createTime = createTime;
		this.updateBy = updateBy;
		this.updateTime = updateTime;
		this.proRecords = proRecords;
		this.batchProductses = batchProductses;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "plantid", unique = true, nullable = false, length = 32)
	public String getPlantid() {
		return this.plantid;
	}

	public void setPlantid(String plantid) {
		this.plantid = plantid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "blockid")
	public ParkBlock getParkBlock() {
		return this.parkBlock;
	}

	public void setParkBlock(ParkBlock parkBlock) {
		this.parkBlock = parkBlock;
	}

	@Column(name = "cropid", length = 32)
	public String getCropid() {
		return this.cropid;
	}

	public void setCropid(String cropid) {
		this.cropid = cropid;
	}

	@Column(name = "crop_name", length = 50)
	public String getCropName() {
		return this.cropName;
	}

	public void setCropName(String cropName) {
		this.cropName = cropName;
	}

	@Column(name = "begin_time", length = 23)
	public Date getBeginTime() {
		return this.beginTime;
	}

	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}

	@Column(name = "end_time", length = 23)
	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Column(name = "is_current", length = 1)
	public String getIsCurrent() {
		return this.isCurrent;
	}

	public void setIsCurrent(String isCurrent) {
		this.isCurrent = isCurrent;
	}

	@Column(name = "plant_status", length = 1)
	public String getPlantStatus() {
		return this.plantStatus;
	}

	public void setPlantStatus(String plantStatus) {
		this.plantStatus = plantStatus;
	}
	
	@Column(name = "plant_type", length = 1)
	public String getPlantType() {
		return plantType;
	}

	public void setPlantType(String plantType) {
		this.plantType = plantType;
	}

	@Column(name = "isdel", length = 1)
	public String getIsdel() {
		return isdel;
	}
	public void setIsdel(String isdel) {
		this.isdel = isdel;
	}

	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "create_by", length = 32)
	public String getCreateBy() {
		return this.createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	@Column(name = "create_time", length = 23)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_by", length = 32)
	public String getUpdateBy() {
		return this.updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}

	@Column(name = "update_time", length = 23)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parkBlockPlant")
	@JsonIgnore
	public Set<ProRecord> getProRecords() {
		return this.proRecords;
	}

	public void setProRecords(Set<ProRecord> proRecords) {
		this.proRecords = proRecords;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parkBlockPlant")
	@JsonIgnore
	public Set<BatchProducts> getBatchProductses() {
		return this.batchProductses;
	}

	public void setBatchProductses(Set<BatchProducts> batchProductses) {
		this.batchProductses = batchProductses;
	}

}